package com.hyl.ssm.service;

import com.hyl.ssm.dao.PetDao;
import com.hyl.ssm.entity.Pet;
import jakarta.annotation.Resource;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * PetServiceImpl
 *
 * @author hyl
 * @date 2024-12-12
 */

@Data
@Service
public class PetServiceImpl implements PetService {

    @Qualifier("petDaoJDBCImpl") //指定名称
    @Autowired(required = false) //根据类型自动注入
    private PetDao petDao ;//= PetFactory.createPet(Comment.DB_TYPE);

//    @Resource  //根据名称
//    private PetDao petDaoJDBCImpl;

    @Override
    public int addPet(Pet pet) {
        petDao.addPet(pet);
        return 0;
    }


}
